package routes

import (
	"github.com/goravel/framework/contracts/route"
	"github.com/goravel/framework/facades"

	"goravel/app/http/controllers/common"
	"goravel/app/http/controllers/permission"
	"goravel/app/http/middleware"

	"goravel/app/http/controllers"
)

func Api() {
	userController := controllers.NewUserController()
	facades.Route().Get("/users/{id}", userController.Show)

	facades.Route().Prefix("/api").Group(func(router route.Router) {

		router.Prefix("/common").Group(func(router route.Router) {
			router.Post("/login", common.NewLoginController().Login)
		})
		router.Middleware(middleware.AuthMiddleware()).Group(func(router route.Router) {
			router.Prefix("/permission").Group(func(router route.Router) {
				router.Get("/menus", permission.NewMenuController().GetMenus)
			})
		})

	})
}
